const path = require("path")
const htmlWebpackPlugin = require("html-webpack-plugin");
const { VueLoaderPlugin } = require('vue-loader')

// webpack 打包配置文件
// 配置好后 就可以直接 webpack 
module.exports = {
    // 源文件
    entry:path.join(__dirname,"./src/main.js"),
    // 打包文件
    output:{
        path:path.join(__dirname,"./dist"),
        filename:"bundle.js"
    },
    // 配置插件的节点
    plugins:[
        new htmlWebpackPlugin({
            // 插件一个 在内存中 生成html的插件
            template:path.join(__dirname,"./src/index.html"),
            filename:"index.html"
        }),
        new VueLoaderPlugin()
    ],
    module:{
        rules:[
            {test:/\.vue$/,use:'vue-loader'},
            {test:/\.(jpg|png|bmp|gif|jpeg)$/,use:"url-loader?limit=9000&name=[hash:8]-[name].[ext]"},
            {test:/\.(ttf|woff2|woff|eot|svg|dtd)$/,use:"url-loader"},
            {test:/\.css$/, use:["style-loader","css-loader"]},
            {test:/\.less$/,use:["style-loader","css-loader","less-loader"]},
        ]
    }
}